#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    Dialog *dialog = new Dialog(this);
    connect(ui->dialogButton,SIGNAL(clicked()),this,SLOT(openDialogSlot()));
    connect(dialog,SIGNAL(dialogSetStr(QString)),this,SLOT(getStr(QString)));

}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::getStr(QString str) {
    qDebug()<<"Main str "<<str;
    ui->receiveLineEdit->setText(str);
}

void MainWindow::openDialogSlot() {
    Dialog *d = new Dialog;
    d->show();
}
